<?php

defined('APP_DIR') or die('404 Not Found');

FLEA::loadClass('Common_Action');

class Controller_Articles extends Common_Action {
	function __construct($ctlName) {
		parent::__construct($ctlName);
		$this->tplDir = TPL_F;//模板位置
		$this->_modelArticle = FLEA::getSingleton('Model_News');
		$data = array(
			'header' => TPL . $this->tplDir . 'header.php',
			'footer' => TPL . $this->tplDir . 'footer.php'
		);
		$this->tpl->assign($data);
	}

 	function index() {
		redirect(url());
	}

	function disp() {
		$articleId = $this->saveGet('article');
		if (empty($articleId)) $articleId = 0;
		$viewData = $this->_modelArticle->getInfo($articleId);
		$this->_out('article/display', $viewData);
	}

	function orders() {
		$viewData =  array('newss' => $this->_modelArticle->getList('index', 0, 20, false) );
		$this->_out('orders', $viewData);
	}
	
	function showMore() {
		$_modNews = FLEA::getSingleton('Model_News');
		$viewData = array(
			'tNews' => $_modNews->getList('jj', 0, 51, 0)
		);
		//dump($viewData);
		$this->_out('article/showMore', $viewData);
	}

}
